<?php

/**
 * MockComparable class
 * a mock IRaiseComparable object
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Mocks
 */
class MockComparator implements IRaiseComparator {

    /**
     * The array key to compare
     * @var string
     */
    private $column = 'v';

    public function __construct(){

    }

    /**
     * Get or set the column used to compare
     * @param string $c If passed, the new value will be set
     * @return string
     */
    public function column($c = null){
        if($c){
            $this->column = $c;
        }
        return $this->column;
    }

    /**
     * Compare the two arrays
     * @param array $o1
     * @param array $o2
     */
    public function compare($o1, $o2) {
        return $o1[$this->column] < $o2[$this->column] ? -1 : 1;
    }

}

